<template>
    <!--地图容器-->

    <div id="XSDFXPage" class="XSDFXPage"></div>
</template>
<script>
import BMap from 'BMap'
    export default {
        name:'bdMap',
        data () {
            return {

            }
        },
        metaInfo: {
              title: 'index', // set a title
              meta: [{                 // set meta
                name: 'keyWords',
                content: '关键字,webpack'
              },
              {                 // set meta
                name: 'description',
                content: '这是首页的描述部分'
              }],
              link: [{                 // set link
                rel: 'stylesheet',
                href: 'http://cdn.yhq.lenovo.com.cn/aceSource/css/ace.css'
              }],
              script:[
              {
                src:"http://cdn.yhq.lenovo.com.cn/aceSource/js/ace.js"  
              }]
          },
        mounted() {
            var map = new BMap.Map("XSDFXPage");
            var geolocation = new BMap.Geolocation();
           geolocation.getCurrentPosition(function(r){
            var Xpoint = 0,Ypoint = 0;
            if(this.getStatus() == BMAP_STATUS_SUCCESS){
                Xpoint = r.point.lng;
                Ypoint = r.point.lat;
                //发送地理位置信息保存到后台
               
                map.centerAndZoom(new BMap.Point(Xpoint,Ypoint),17);
                map.panTo(r.point);
            }
        });
        }
    }
</script>
<style scoped>
    html,body,.XSDFXPage{
            width: 100%;
            height: 500px;
            overflow: hidden;
            margin: 0;
            font-family: "微软雅黑";
        }
</style>